'''
Created on Aug 17, 2010

@author: riche
'''
import unittest
import filecmp
from ft.framework import system, copier
from ft.tests.as_sys import as_sys
from ft.directory import cameras, localhost


class Test(unittest.TestCase):


    def setUp(self):
        cop = copier.Copier(s_file='{}ft/tests/as_sys/TEST_INPUT.txt'.format(localhost.local_directory.package_root),
                            d_hst=cameras.local_directory.address(cameras.CLIENT_NAME),
                            d_file='{}ft/tests/as_sys/'.format(cameras.local_directory.package_root))
        cop.copy()

    def tearDown(self):
        pass


    def test_as_sys(self):
        '''Files should be the same after exeuction'''
        as_sys.run_as_sys()
        cop = copier.Copier(s_file='{}ft/tests/as_sys/TEST_OUTPUT.txt'.format(cameras.local_directory.package_root),
                            s_hst=cameras.local_directory.address(cameras.CLIENT_NAME),
                            d_file='{}ft/tests/as_sys/'.format(localhost.local_directory.package_root))
        cop.copy()
        retval = filecmp.cmp('{}ft/tests/as_sys/TEST_INPUT.txt'.format(localhost.local_directory.package_root), 
                             '{}ft/tests/as_sys/TEST_OUTPUT.txt'.format(localhost.local_directory.package_root),
                             shallow=False)
        if not retval:
            raise system.FilesNotTheSameException 
            


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testASSys']
    unittest.main()